﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Storage;
using XNA2DCollisionDetection;

namespace _2DGame
{
    class PointObject : GameObject
    {
        public PointObject(Vector2 cord, Texture2D texture2D) : base(cord)
        {
            Texture = texture2D;
        }
        public void PickUpObject(SpriteBatch spriteBatch, Player player, SoundEffect EatSound)//added inparamneter for playning sound
        {
            //check if the objekt and player intersect
            if(CollisionDetection2D.PerPixel(Texture, player.PlayerGraphics, Cord, player.PlayerCord))
            {   //add points and remove the objekt
                GameBordI.UpdatePoints(spriteBatch, 20000);
                Texture = null;
                EatSound.Play(1F, 1F, 0F);//paly nom sound when katt eat
            }
        }
        public void MoveObject()
        {
            _Cord.X = Cord.X - LevelController.SpeedRunner();
        }
    }
}
